#include <bits/stdc++.h>
#define int long long
#define PII pair <int, int>
using namespace std;
const int N = 2e4 + 5;
int n, ansx, anssc = 1e18, anssum;
int a[N], b[N];
struct Tree {
	int node[N];
	vector <int> use;
	void add(int x, int k) { use.push_back(x); for(; x < N; x += x & -x) node[x] += k; }
	void clear() { for(int x : use) for(; x < N; x += x & -x) node[x] = 0; use.clear(); }
	int gsum(int x) { return x ? node[x] + gsum(x - (x & -x)) : 0; }
} tree;
signed main() {
	freopen("rotate.in", "r", stdin);
	freopen("rotate.out", "w", stdout);
	ios :: sync_with_stdio(0);
	cin.tie(0), cout.tie(0);
	cin >> n;
	for(int i = 1; i <= n; i ++ ) {
		cin >> a[i];
		b[a[i]] = i;
	}
	for(int x = 1; x <= 30; x ++ ) {
		int sum = 0, sc = 0;
		tree.clear();
		for(int i = n; i >= 1; i -- ) {
			int old = b[i] - tree.gsum(b[i]);
			if(old < i) {
				int len = i - old;
				sum += len / x + len % x;
				sc += len % x;
				tree.add(b[i], 1);
			}
		}
		if(sum <= 1.9e6 && sc < anssc) {
			ansx = x;
			anssc = sc;
			anssum = sum;
		}
	}
	cout << ansx + 1 << ' ' << anssum << '\n';
	tree.clear();
	for(int i = n, j; i >= 1; i -- ) {
		int old = b[i] - tree.gsum(b[i]);
		if(old < i) {
			for(j = old; j + ansx <= i; j ++ ) cout << 1 << ' ' << j << '\n';
			for(; j < i; j ++ ) cout << 2 << ' ' << j << '\n';
			tree.add(b[i], 1);
		}
	}
	return 0;
}

